<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="java.util.*"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HR医院 - 安排加班</title>
<meta name="keywords" content="">
<meta name="description" content="">

<link rel="shortcut icon" href="favicon.ico">
<link href="<%=path%>/statics/css/bootstrap.min.css?v=3.3.6"
	rel="stylesheet">
<link href="<%=path%>/statics/css/font-awesome.css?v=4.4.0"
	rel="stylesheet">

<!-- Data Tables -->
<link
	href="<%=path%>/statics/css/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">
<link href="<%=path%>/statics/css/animate.css" rel="stylesheet">
<link href="<%=path%>/statics/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>安排加班</h5>
					</div>
					<div class="ibox-content">
						<form method="post" class="form-horizontal" id="commentForm"
							action="add">
							<div class="form-group">
								<label class="col-sm-3 control-label">部门</label>
								<div class="col-sm-7">
									<select class="form-control m-b" id="department"
										name="departmentNumber" size="1">
										<option>--请选择部门--</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">员工</label>
								<div class="col-sm-7">
									<select class="form-control m-b" id="employee"
										name="employeeNumber" size="1" required>
										<option>--请选择员工--</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">加班日期</label>
								<div class="col-sm-7">
									<input type="date" class="form-control" size="1" name="date"
										required>
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<div class="col-sm-4 col-sm-offset-8">
									<button class="btn btn-success" type="submit">添&nbsp;&nbsp;加</button>
									&nbsp;&nbsp;&nbsp;&nbsp;
									<button class="btn btn-white" type="reset">取&nbsp;&nbsp;消</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- 全局js -->
	<script src="<%=path%>/statics/js/jquery.min.js?v=2.1.4"></script>
	<script src="<%=path%>/statics/js/bootstrap.min.js?v=3.3.6"></script>
	<script
		src="<%=path%>/statics/js/plugins/jeditable/jquery.jeditable.js"></script>

	<!-- Data Tables -->
	<script
		src="<%=path%>/statics/js/plugins/dataTables/jquery.dataTables.js"></script>
	<script
		src="<%=path%>/statics/js/plugins/dataTables/dataTables.bootstrap.js"></script>

	<!-- 自定义js -->
	<script src="<%=path%>/statics/js/content.js?v=1.0.0"></script>

	<!-- 表单验证 -->
	<script
		src="<%=path%>/statics/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="<%=path%>/statics/js/plugins/validate/messages_zh.min.js"></script>

	<!-- layer javascript -->
	<script src="<%=path%>/statics/js/plugins/layer/layer.min.js"></script>
	<script type="text/javascript">
		$(function() {
			$
					.ajax({
						type : "post",
						url : "getDepData",
						dataType : "json",
						success : function(data) {
							//console.log(data)
							for (var i = 0; data.length; i++) {
								var option = $("<option value="+data[i].departmentNumber+">"
										+ data[i].name + "</option>");
								$("#department").append(option);
							}
						}
					});

			$("#department")
					.change(
							function() {
								var value = $("#department option:selected")
										.val();
								$
										.ajax({
											type : "post",
											url : "getEmpData",
											data : "departmentNumber=" + value,
											dataType : "json",
											success : function(data) {
												$(
														"#employee option:first~option")
														.remove();
												for (var i = 0; data.length; i++) {
													var option = $("<option value="+data[i].employeeNumber+">"
															+ data[i].name
															+ "</option>");
													$("#employee").append(
															option);
												}
											}
										})
							})
		});

		/* function changemployee(option){
			
		} */
	</script>
</body>
</html>
